<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>分类管理 - Layui</title>
<link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="/css/admin.css">
<link rel="stylesheet" href="/css/mypage.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-header">
<!-- 头部区域（可配合layui已有的水平导航） -->
  @include('admin.header')
</div>
<div class="layui-side layui-bg-black">
  @include('admin.left')
</div>
<div class="layui-body">
 <table class="table table-hover" id="list">
  <tr>
    <th width="145">选择</th>
    <th width="145">ID</th>
    <th width="120">类名</th>               
    <th >类描述</th>               
    <th width="220">操作</th>
  </tr>
  
 <?php foreach($kinds->results as $val=>$v):?>
   <tr>
    <td><input type="checkbox"  value="<?php echo $v['id'];?>"  /></td>
    <td><?php echo $v["id"]?></td>
    <td><?php echo $v["king"];?></td>  
    <td><?php echo $v["explanation"];?></td>                       
    <td><a href="change?id={{$v['id']}}">修改</a> <a class="button border-yellow button-little" href="dele?id={{$v["id"]}}" onclick="{
                if (confirm('确认删除?删除后整个分类下面的文章将全部删除.')) {
                    return true;
                }
                return false;
            }">删除</a></td>
   </tr>
 <?php endforeach;?>
  </table>
  <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;"> </fieldset>
    <div id="page-v" style="margin-left: 50px"></div>
</div>
</div>
<script src="/layui/layui.js"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
var form = layui.form()
,layer = layui.layer
,layedit = layui.layedit
,laydate = layui.laydate;

//创建一个编辑器
var editIndex = layedit.build('LAY_demo_editor');



})

//JavaScript代码区域
layui.use('element', function(){
  var element = layui.element(); //导航的hover效果、二级菜单等功能，需要依赖element模块

});

layui.use(['laypage', 'layer'], function(){

  var total = <?php echo $all; ?>;
  var laypage = layui.laypage
  ,layer = layui.layer;

  //好像很实用的样子，后端的同学再也不用写分页逻辑了。
  laypage({
    cont: 'page-v',
    pages: <?php echo $all; ?>, //可以叫服务端把总页数放在某一个隐藏域，再获取。假设我们获取到的是18
    curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
      var page = location.search.match(/page=(\d+)/);
      return page ? page[1] : 1;
    }(), 
    jump: function(e, first){ //触发分页后的回调
      if(!first){ //一定要加此判断，否则初始时会无限刷新
        location.href = '?page='+e.curr;
      }
    }
  });


});



</script>
</body>
</html>